<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
 
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html >
<html>
<head>
		<title></title>
		<style type="text/css">
		#e{
		
			height:40px;
			margin-top: 20px;
		}
		input{
			width:100px;
		}
		.btn{
			width:50px;
		}
		.hrlogo{
			width:100%;
			height:350px;
		}
		</style>
		<!--适配于手机终端和PAD等移动终端，禁止缩放-->
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<meta charset="UTF-8" />
		<link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
	</head>

<body>
<script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
		<script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
		<div class="container">
	<div class="row clearfix">
		<div class="col-md-12 column">
			<ul class="nav nav-tabs">
				<li>
					 <a href="${pageContext.request.contextPath}/dept_findAll.action">部门表</a>
				</li>
				<li class="active">
					 <a href="${pageContext.request.contextPath}/queryfind.action">员工表 </a>
				</li>
				<li>
					 <a href="${pageContext.request.contextPath}/contract_find_findByFirstPage.action">部门合同</a>
				</li>
				<li>
					 <a href="http://localhost:8080/spring03_1prac/Human_Resource_find_findAll.action">人才资源管理</a>
				</li>
				<li>
					 <a href="http://localhost:8080/spring03_1prac/transfer_find_findAll.action">人员调动管理</a>
				</li>
				<li>
					 <a href="${pageContext.request.contextPath}/eva_findAll.action">员工绩效评估</a>
				</li>
				<li>
					 <a href="${pageContext.request.contextPath}/hrmr_find_findHRReport.action">HR月报</a>
				</li>
				<li>
					 <a href="${pageContext.request.contextPath}/leave_findAll.action">考勤</a>
				</li>
				<li >
					 <a href="${pageContext.request.contextPath}/advise_findAll.action">招聘表</a>
				</li>	
			</ul>		
		<img src = "${pageContext.request.contextPath }/jsp-zt/img/worker.jpg" class="hrlogo" >
		<div class="col-md-4 column">
		</div>
			<table class="table">
				<thead>
					<tr>
							<th>合同编号</th>
							<th>部门号</th>
							<th>员工号</th>
							<th>签署日期</th>
							<th>合约年限</th>
							<th>合同状态</th>
							<th>剩余时间</th>
							<th colspan="2" align="center">操作</th>
						</tr>
				</thead>
				<tbody>
				<c:forEach items="${list}" var="contract">
							<tr>
								<form action="contract_update_update.action" method="get">
									<td>
										<input type="text" value="${contract.contract_id}" name="contract_id" />
									</td>
									<td>
										<input type="text" value="${contract.deptno}" name="deptno" />
									</td>
									<td>
										<input type="text" value="${contract.empno}" name="empno" />
									</td>
									<td>
										<input type="date" value="${contract.sign_date}" name="sign_date" />
									</td>
									<td>
										<input type="text" value="${contract.sign_age}" name="sign_age" />
									</td>
									<td>
										<input type="text" value="${contract.sign_state}" id="sign_state" />
									</td>
									<td>
										<input type="text" value="${contract.rest_years}" name="rest_years" />
									</td>
									<td>
										<input type="submit" class="btn" value="修改"/>
									</td>
								</form>
								<form action="contract_update_delete.action" method="get">
									<td>
										<input type="hidden" value="${contract.contract_id}" name="contract_id" />
										<input type="submit" class="btn" value="删除"/>
									</td>
								</form>
							</tr>
						</c:forEach>
				</tbody>
			</table>
			<div>
				<input type="hidden" id="endPage" value="${endPage}"/>
				<input type="hidden" id="totalPage" value="${pageNum}"/>
				<a href="${pageContext.request.contextPath}/contract_find_findByFirstPage.action">首页</a>
				<a href="${pageContext.request.contextPath}/contract_find_findByPage.action?pageNum=${pageNum-1}" id="lastPage">上一页</a>
				<span class="box">
	            	跳转:<input type="text" id="findByPages" readonly="readonly" value="请选择页码">
		           		<ul type="disc">
		           			<c:forEach var="page" begin="1" end="${endPage}">
		           				<li>
		           					<a href="${pageContext.request.contextPath}/contract_find_findByPage.action?pageNum=${page}">第${page}页</a>
		           				</li>
		           			</c:forEach>
		           		</ul>
	           		</input>
	            </span>
				<a href="${pageContext.request.contextPath}/contract_find_findByPage.action?pageNum=${pageNum+1}" id="nextPage">下一页</a>
				<a href="${pageContext.request.contextPath}/contract_find_findByPage.action?pageNum=${endPage}">末页</a>
			</div>
			<a href="${pageContext.request.contextPath}/jsp-zt/insertContract.jsp">添加</a>
		</div>
	</div>
</div>
</br></br></br></br></br></br></br></br></br></br>
</br></br></br></br></br></br></br></br></br></br>
<script type="text/javascript" charset="UTF-8" src="jsp-zt/js/jquery-3.1.0.min.js"></script>
	<script type="text/javascript">
		$(function(){
			console.log("------"+$("#totalPage").val());
			var page=$("#totalPage");
			var pageNum=page.val();
			console.log("page.val()="+page.val());
			console.log("pageNum="+pageNum);
			var end=$("#endPage");
			var endPage=end.val();
			console.log("endPage="+endPage);
			var lastPage=$("#lastPage");
			var nextPage=$("#nextPage");
			if(pageNum==1){
				lastPage.empty();
			}else if(pageNum==endPage){
				nextPage.empty();
			}
			$("#findByPages").blur(function(){
				$("ul").css("type","square");
			});
			$("#findByPageBtn").click(function(){
				var $pageNum=$("#pageNum").val();
				console.log("pageNum="+$pageNum);
				
				$.ajax({
					url:"${pageContext.request.contextPath}/contract_find_findByPage.action",
					type:"post",
					async:true,
					data:{
						pageNum:$("#pageNum").val()
					},
					success:function(){
						var $tbody=$("#content").remove();
						$tbody.appendTo($("table"));
					}
				});		
			});
			$(".box").bind({
		        "mouseenter":function(){
		                $(this).find("ul").show()
		        },
		        "mouseleave":function(){
		                $(this).find("ul").hide()
		        },
		        "click":function(event){
		                if (event.target.tagName == "LI") {
		                        $(this).find("input").val($(event.target).text()); //传具体的文字
		         }
		                $(this).find("ul").hide();
		        }
			})
		});		 
	</script>
</body>
</html>